package com.svse.designPattern.singleresponsibilityprinciple;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/7/25 16:12
 */
public class SingleResponsibility2 {
    public static void main(String[] args) {
        RoadVehicle roadVehicle = new RoadVehicle();
        roadVehicle.run("越野车");
        AirVehicle airVehicle = new AirVehicle();
        airVehicle.run("飞机");
        WaterVehicle waterVehicle = new WaterVehicle();
        waterVehicle.run("船");
    }
}

/**
 * 每一种交通工具 一个类
 * 会导致 类越来越多
 */

class RoadVehicle{
    void run(String vehicle){
        System.out.println(vehicle+"在路上跑");
    }
}
class AirVehicle{
    void run(String vehicle){
        System.out.println(vehicle+"在天上跑");
    }
}
class WaterVehicle{
    void run(String vehicle){
        System.out.println(vehicle+"在水上跑");
    }
}